package com.opgea.crm.repository;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import com.opgea.crm.domain.entities.Company;

@Repository
public class CompanyRepoImpl implements CompanyRepo {

	@PersistenceContext
	EntityManager em;
	
	
	public void createCompany(Company company) {
			em.persist(company);
		
	}



	public void remove(long id) {
		// TODO Auto-generated method stub
		
	}



	public Company find(long id) {
		return em.find(Company.class, id);
	}



	public List<Company> findAll() {
		String query = "SELECT c FROM Company c";
		List<Company> companyList = em.createQuery(query, Company.class).getResultList();
		return companyList;
	}

}
